import { createRouter, createWebHistory } from 'vue-router'

import Layout from '@/components/Layout.vue'
const AdminLogin = () => import('@/views/Login.vue')
const DashBoard = () => import('@/views/DashBoard.vue')
const Positions = () => import('@/views/Positions.vue')
const Department = () => import('@/views/Department.vue')
const Admin = () => import('@/views/Admin.vue')
const Profile = () => import('@/views/Profile.vue')
const Resumes = () => import('@/views/Resume.vue')
const Security = () => import('@/views/Security.vue')
const InterviewSchedule = () => import('@/views/InterviewSchedule.vue')
const InterviewFeedback =() => import('@/views/InterviewFeedback.vue')
const User=()=>import('@/views/User.vue')
const Talent=()=>import('@/views/Talent.vue')


const Home=()=>import('@/user/Home.vue')
const UserLogin=()=>import('@/user/Login.vue')
const Register=()=>import('@/user/Register.vue')
const Apply=()=>import('@/user/Apply.vue')
const PersonalCenter=()=>import('@/user/PersonalCenter.vue')
const FindPassword=()=>import('@/user/FindPassword.vue')
const routes = [
  {
    path: '/',
    redirect: '/admin/login'
  },
  {
    path: '/admin/login',
    name: 'AdminLogin',
    component: AdminLogin
  },
  {
    path:'/user/home',
    name:'Home',
    component:Home
  },
  {
    path:'/user/login',
    name:'UserLogin',
    component:UserLogin
  },
  {
    path:'/user/register',
    name:'Register',
    component:Register
  },
  {
    path:'/user/apply/:positionId',
    name:'Apply',
    component:Apply,
  },

  {
    path:'/user/profile',
    name:'PersonalCenter',
    component:PersonalCenter
  },
  {
    path:'/user/findPassword',
    name:'FindPassword',
    component:FindPassword
  },
  
  {
    path: '/admin/',
    redirect: '/admin/dashboard',
    name: 'Layout',
    component: Layout,
    children: [
      {
        path: 'dashboard',
        name: 'DashBoard',
        component: DashBoard
      },
      {
        path: 'positions/list',
        name: 'Positions',
        component: Positions
      },
      {
        path: 'department/list',
        name: 'Department',
        component: Department
      },
      {
        path:'user/list',
        name:'User',
        component:User

      },
      {
        path: 'admin/list',
        name: 'Admin',
        component: Admin
      },
      {
        path: 'profile',
        name: 'Profile',
        component: Profile
      },
      {
        path: 'resumes/list',
        name: 'Resumes',
        component: Resumes
      },
      {
        path: 'security',
        name: 'Security',
        component: Security
      },
      {
        path: 'interview/schedule',
        name: 'InterviewArrange',
        component: InterviewSchedule
      },
      {
        path:'interview/feedback',
        name:'InterviewFeedback',
        component:InterviewFeedback
      },
      {
        path:'talents/list',
        name:'Talent',
        component:Talent
      }

    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})


export default router 